using System.Linq;

namespace MissingNumber
{
    public class Solution
    {
        public int MissingNumber(int[] nums)
        {
            var sum = nums.Sum();
            var nSum = (1 + nums.Length) * nums.Length / 2;
            return nSum - sum;
        }
    }
}